﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    public class Diagnose
    {
        public int? ID;
        public string name;
        public string description;


        public Diagnose()
        {
        }

        public Diagnose(int ID, string n, string d)
        {
            this.ID = ID;
            this.name = n;
            this.description = d;
        }

        public string ToDbFormat()
        {
            return ID + "," + name + "," + description;
        }


        public static Diagnose ParseFromDb(String s)
        {
            string[] ar = s.Split(',');
            return ParseFromStringArray(ar);
        }

        public static Diagnose ParseFromStringArray(string[] ar)
        {
            Diagnose diag = new Diagnose();
            if (ar[0] != null)
            {
                diag.ID = Convert.ToInt32(ar[0]);
            }
            diag.name = ar[1];
            diag.description = ar[2];

            return diag;
        }
    }
}
